'''
from selenium import webdriver
from pprint import pprint

# 打开浏览器 请求目标网址
driver = webdriver.Chrome()
driver.get('https://www.baidu.com')

# 操作cookie 获得所有的cookie信息
pprint(driver.get_cookies())

# 返回特定name的cookie信息  driver.get_cookie(name)
print(driver.get_cookie('BIDUPSID'))

# 添加cookie，必须有name 和 value值
dict1 = {'name': 'haha', 'value': '123'}
driver.add_cookie(dict1)
pprint(driver.get_cookies())


# 退出
driver.quit()
'''

from selenium import webdriver
from pprint import pprint

# 打开浏览器, 请求目标网址
driver = webdriver.Chrome()
driver.get('https://email.163.com/')

# 操作cookie
# driver.get_cookies()获得所有cookie信息
pprint(driver.get_cookies())
# driver.get_cookie(name)返回特定name的cookie信息
# print(driver.get_cookie('BA_HECTOR'))

# driver.add_cookie(cookie_dict)添加cookie,必须有name 和value 值
# dict1 = {'name': 'hello', 'value': '11111111'}
# driver.add_cookie(dict1)
# pprint(driver.get_cookies())

# driver.delete_cookie(name)删除特定(部分)的cookie信息
# driver.delete_cookie('hello')
# pprint(driver.get_cookies())

# driver.delete_all_cookies()删除所有cookie 信息
# driver.delete_all_cookies()
# pprint(driver.get_cookies())

# 退出浏览器
driver.quit()
